﻿using System;
using System.Collections.Generic;
using System.Windows.Media;

namespace personalplaner.business.dienstplan.plancollection
{
	public class SimpleRow : ListBase<PlanItem>, IDienstPlanRow
	{
		public void Initialize(DateTime beginDate, IList<PlanItem> items)
		{
			int cnt = DateTime.DaysInMonth(beginDate.Year, beginDate.Month);
			for (int i = 0; i < cnt; i++)
				Add(new PlanItem
				{
					Datum = new DateTime(beginDate.Year, beginDate.Month, i + 1),
				});



			if (items == null)
				return;

			//foreach (var itm in items)
			//{
			while (items.Count > 0)
			{
				var itm = items[0];
				foreach (var planitem in this)
				{
					if (itm.Datum == planitem.Datum)
					{
						if (itm.Color == null || itm.Color == Colors.Transparent)
							itm.Color = planitem.Color;

						Replace(planitem, itm);
						items.Remove(itm);
						break;
					}
				}
			}
		}

		#region IDienstPlanRow Members
		
		int IDienstPlanRow.AbteilungId
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		string IDienstPlanRow.Abteilung
		{
			get
			{
				return "";
			}
			set
			{
			}
		}

		int IDienstPlanRow.PlanSchemaId
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		int? IDienstPlanRow.Pensum
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		double? IDienstPlanRow.Vortrag
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		double? IDienstPlanRow.Soll
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		double? IDienstPlanRow.Haben
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		double? IDienstPlanRow.Anpassung
		{
			get
			{
				return 0;
			}
			set
			{
			}
		}

		double? IDienstPlanRow.Differenz
		{
			get { return 0; }
		}

		Color IDienstPlanRow.RowColor
		{
			get
			{
				return Colors.Transparent;
			}
			set
			{
			}
		}

		Color IDienstPlanRow.HeaderColor
		{
			get
			{
				return Colors.Transparent;
			}
			set
			{
			}
		}

		#endregion

		
	}
}
